﻿using System;

namespace Trentacular.SharePoint.StsAdmin
{
    public class SmartExecuteJobDefinitionsCommand : BaseStsadmCommand
    {
        protected override void CreateParameters() { }
        protected override void ValidateParameters() { }

        protected override void Execute()
        {
            try
            {
                var jobDefinitionExecutor = new JobDefinitionExecutor();
                jobDefinitionExecutor.ExecuteJobDefinitions();
                ErrorCount = jobDefinitionExecutor.ErrorCount;
            }
            catch (Exception e)
            {
                ErrorCount++;
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
                throw e;
            }
        }
    }
}
